import org.junit.Test;
import com.ceb.proxy.MyInvocationHandler;
import com.ceb.service.Userservice;
import com.ceb.service.UserserviceImpl;

import java.lang.reflect.Proxy;

/**
 * @author name:dss
 * @version 1.0
 * @description: TODO
 * @date 2022/8/232022/8/23
 */
public class testproxy {
    @Test
    public void testDynamic(){
        UserserviceImpl userservice = new UserserviceImpl();

        MyInvocationHandler myInvocationHandler = new MyInvocationHandler(userservice);

        Userservice proxy = (Userservice)Proxy.newProxyInstance(userservice.getClass().getClassLoader(),new Class[]{Userservice.class},myInvocationHandler);

        proxy.add();
        proxy.select();
    }
}
